home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1992-02-26 | 1.9 KB | 70 lines |
- ' Number_Requester.Amos - Steve Pullinger
-
-
- ' Uses Interface to get a number from the user
-
-
- ' Initialise Interface resources
- Load "AMOSPro_Tutorial:Tutorials/Interface/Example_resource.abk"
- Resource Bank 16
- Resource Screen Open 0,640,200,0
- Flash Off : Curs Off : Cls 0 : Paper 0 : Pen 8
- Palette ,,,,$840,$C84,$FC8,$FEB
- Wait Vbl
-
-
- ' Example procedure call
- N_REQUEST["Please Enter a number",310]
- NR=Param : Rem Get return value
-
- ' Print String from basic
- Print "Procedure returned: ";NR
-
- ' To call the procedure, pass a string for the title and a default value
-
- Procedure N_REQUEST[TITLE$,DEF_VAL]
-
- ' This procedure displays an Interface requester centred on-screen
- ' The title for the requester is passed as TITLE$ and the procedure
- ' returns the number input from an Interface enter DIgit zone
-
- ' DEF_VAL is a default value for the requester
- ' EXAMPLE: REQUEST["Please enter a number"]
-
- ' Interface Program
-
- IN_STRING$=IN_STRING$+"BAse 80,40;"
- IN_STRING$=IN_STRING$+"SIze 1VATextWidth32+,TextHeight6*;"
- IN_STRING$=IN_STRING$+"BAse ScreenWidth SizeX-2/,ScreenHeight SizeY-2/;"
- IN_STRING$=IN_STRING$+"SAve 1;"
- IN_STRING$=IN_STRING$+"BOx 0,0,1,SizeX,SizeY;"
- IN_STRING$=IN_STRING$+"POutline 1VACentreX,10,1VA,0,3;"
-
- ' If you don't want a default value change the 1 after 3VA to 0 below
- IN_STRING$=IN_STRING$+"DI 1,16,32,2VA,3VA,1,4,6 ;"
- IN_STRING$=IN_STRING$+"EXit;"
-
-
- ' Open Communication Channel between Amos and Interface program
- Dialog Open 1,IN_STRING$
-
- ' Pass title string to Interface
- TITLE$=" "+TITLE$
- TITLE$=TITLE$+" "
- Vdialog$(1,1)=TITLE$
- Vdialog(1,2)=Len(TITLE$)
- Vdialog(1,3)=DEF_VAL
-
- ' Call GET_STRING$ program
- X=Dialog Run(1)
-
- ' Wait for input complete
- Repeat
- ' RET is returned by the procedure to Amos
- RET=Rdialog(1,1)
- Until Dialog(1)
-
- ' Close Interface program
- Dialog Close(1)
-
- End Proc[RET]